/*
 * Utility.java
 *
 * Stateroom - Java framework library for finite state machines
 * Copyright (C) 2009 by Matthew Werny
 * All Rights Reserved
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 */
package net.iceflow.stateroom;

/** Utility class containing static methods used generically by Stateroom. */
public class Utility {

   /**
    * Validates that the passed in object is not null.
    * @param object Object instance to validate
    * @param exceptionMessage Text of the message to be used for creating an exception, should the object be found to be null.
    */
   public static final void validateNotNull(final Object object, final String exceptionMessage) {
      // If the object is null...
      if (object == null) {
         // ...throw an exception with the passed in message.
         throw new IllegalArgumentException(exceptionMessage);
      }
   }

   /** Constructor that prevents instantiation, as this is purely a utility class. */
   protected Utility() {
      // Throw an exception to immediately prevent construction of this utility class
      throw new UnsupportedOperationException("Instantiation not allowed.");
   }
}
